#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>
#include<string.h>
int main()
{
	int n;
	scanf("%d", &n);
	int count_1, price_1;
	int count_2, price_2;
	int count_3, price_3;
	scanf("%d %d", &count_1, &price_1);
	scanf("%d %d", &count_2, &price_2);
	scanf("%d %d", &count_3, &price_3);
	int a, b, c;
	if (n%count_1==0)
	{
		a = n / count_1;
	}
	else
	{
		a = n / count_1 + 1;
	}
	if (n % count_2 == 0)
	{
		b = n / count_2;
	}
	else
	{
		b = n / count_2 + 1;
	}
	if (n % count_3 == 0)
	{
		c = n / count_3;
	}
	else
	{
		c = n / count_3 + 1;
	}
	int sum_1 = a * price_1;
	int sum_2 = b * price_2;
	int sum_3 = c * price_3;
	int min_sum = sum_1;
	if (sum_2 < min_sum) min_sum = sum_2;
	if (sum_3 < min_sum) min_sum = sum_3;
	printf("%d\n", sum_1);
	return 0;
}